package com.zx.tfw.enums;

import java.util.HashMap;
import java.util.Map;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;

public enum CountryEnum {
	
	China		(1, "中国"),
	America		(2, "美国"),
	England		(3, "英国"),
	Russia		(4, "俄罗斯"),
	Japanese	(5, "日本"),
	Korea		(6, "韩国");
	
	private int code;
	
	private String name;

	private CountryEnum(int code, String name) {
		this.code = code;
		this.name = name;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	private static Map<Integer, CountryEnum> map;
	static {
		map = new HashMap<>();
		CountryEnum[] values = CountryEnum.values();
		for (CountryEnum typeEnum : values) {
			map.put(typeEnum.getCode(), typeEnum);
		}
	}
	
	public static Map<Integer, CountryEnum> asMap(){
		return map;
	}

}
